<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>中国传媒大学设备预约平台</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="{$projectUrl}/css/admin_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{$projectUrl}/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="{$projectUrl}/js/jquery.cycle.all.min.js"></script>
<script type="text/javascript" src="{$projectUrl}/js/globalJsFunction.js"></script>
<script type="text/javascript">
{literal}
$(document).ready(function(){
    $('#slideshow').cycle({
        fx:     'fade',
        speed:  'slow',
        timeout: 3000,
        pager:  '#slider_nav',
        pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#slider_nav li:eq(' + (idx) + ') a';
        }
    });
});
{/literal}
</script>
</head>
<body>
<div class="main">
  <div class="main_resize">
    <div class="main_left">
      {include file=include/headerLogo.html}
      <div class="clr"></div>
      {include file=include/adminLeftMenu.html}
      <div class="clr"></div>
      <h2>&nbsp;</h2>
    </div>
    <div class="main_right">
      {include file=include/headerLogin.html}

      <div class="clr" style="background-color:#C63; height:1px;">&nbsp;</div>
      <div>
      {include file=include/adminTopMenu.html}
      </div>
      <div class="clr">
      	<p><img src="{$projectUrl}/images/add2.jpg" width="30px" height="20px"><span style="font-color:#C60; font-size:16px;">设备分类</span>(总个数:{$categorynumber})</p>
      	 <!--创建分类-->
      	 {if $addcategoryNotice neq ''}
      	 <p style="color:red"><Strong>{$addcategoryNotice}</Strong></p>
      	 {/if}
                <div id = "create_category_name" style="font-size:14px;">
                <form action="category.php" method="post">
                <input type="hidden" name="action" id="action" value="addcategory"/>
                    <table bgcolor="#FFFFFF" width="100%" style="font-size:14px">
                    	<tr>
                    		<td>分类名字</td>
                    		<td>介绍</td>
                    	</tr>
                    	<tr>
                    		<td><input type="text" id="name" name="name" size="14"/></td>
                    		<td><input type="text" id="info" name="info" size="50"/>&nbsp;<input type="image" src="{$projectUrl}/images/add1.jpg" class="button"/></td>

                    	</tr>
                    </table>
                </form>
                </div>
                <!--创建用户结束-->
      </div>

      <!-- 搜索用户并且进行修改 -->
      <div class="clr">
       <!--全部用户的列表-->
                <div>
                	<p>
                		<span>{if $searchNote eq ""}输入名字进行搜索
                		{else}{$searchNote}
                		{/if}
                		</span>
                		<span style="float:right">
					        <form id="form1" name="form1" method="get" action="category.php">
					        	 <input type="hidden" name="action" id="action" value="search"/>
                                <input type="text" class="keywords" id="keyword" name="keyword" maxlength="50" value="{$keyword}"/>
                                <input name="b" type="submit" class="button" value="搜索" />
					        </form>
					        </span></p>
                <form id="categorylist_form" action="category.php?pageIndex={$pageIndex}" method="post" onsubmit="return window.confirm('确定删除？');">
                <input type="hidden" name="action" id="action" value="deletecategory"/>
                    <table width="100%" bgcolor="#FFFFFF" style="font-size:14px;">
                    <tr valign="top"  style="background-color:#C60">
                        <td>({$categories|@count})</td>
                        <td>分类名</td>
                        <td>介绍</td>
                        <td>创建时间</td>
                        <td>编辑</td>
                    </tr>
                    {foreach from=$categories item=category name=categorylist}
                    <tr valign="top"  onmouseout="this.style.backgroundColor=''"onmouseover="this.style.backgroundColor='#AAAAAA'">
                        <td><input type="checkbox" id="category[]" name="category[]" value="{$category.id}"/></td>
                        <td><span style="font-size:12px;" title="{$category.name}">{$category.name|truncate:40:".."}</span></td>
                        <td>{$category.info}</td>
                        <td><span style="font-size:12px;">{$category.createtime}</span></td>
                        <td><a href="category.php?action=edit&id={$category.id}&pageIndex={$pageIndex}#editCategoryDiv">编辑</a></td>
                    </tr>
                    {/foreach}


                    <tr><td align="right" colspan="2">
                        <input type="button" value="全选" onclick="chkall('categorylist_form')" />
                        <input type="reset" value="不选" />
                        </td>
                        <td align="left" colspan="3">
                        <input type="submit" value="删除选中"/>
                        </td>
                    </tr>
                     <tr>
                    <td colspan="5" align="center">
                    <!-- 分页 -->
                        <a href="category.php?pageIndex={$leftPageIndex}">&lt;</a>

                    {section start=$leftMostPageIndex loop=$pageIndex step=1 name=pagesection}
                    <a href="category.php?pageIndex={$smarty.section.pagesection.index}">
                    {$smarty.section.pagesection.index}&nbsp;&nbsp;
                    </a>
                    {/section}
                    <span style="font-size:18px;"><Strong><bold>{$pageIndex}</bold></Strong>&nbsp;</span>
                    {section start=$pageIndex+1 loop=$rightMostPageIndex+1 step=1 name=rightpagesection}
                    <a href="category.php?pageIndex={$smarty.section.rightpagesection.index}">
                    {$smarty.section.rightpagesection.index}&nbsp;&nbsp;
                    </a>
                    {/section}

                    <a href="category.php?pageIndex={$rightPageIndex}">&gt;</a>
                    <!-- 分页 -->
                    </td>
                    </tr>
                    </table>
                </form>
                </div>
                <!--全部用户的列表-->
      </div>
      <!-- 搜索用户并且进行修改 结束-->
      <div class="clr"></div>
      <!-- 编辑用户 -->
      <div class="clr" id="editCategoryDiv" style="display:{if $editCategory.id eq ''}none{/if}">
      	<p><img src="{$projectUrl}/images/img_1.jpg" width="30px" height="30px"><span style="font-color:#C60; font-size:16px;">修改分类信息</span></p>
                <div id = "modify_category" style="font-size:14px;">
                <form action="category.php?id={$editCategory.id}&pageIndex={$pageIndex}#editCategoryDiv" method="post">
                <input type="hidden" name="action" id="action" value="modifycategory"/>
                <input type="hidden" name="categoryid" id="categoryid" value="{$editCategory.id}"/>
                    <table bgcolor="#FFFFFF" width="100%" style="font-size:14px;">
                    	<tr>
                    		<td>姓名</td><td><input type="text" id="name" name="name" size="14" value="{$editCategory.name}"/></td>
                    		</tr>
                    	<tr>
                    		<td>介绍</td><td><input type="text" id="info" name="info" size="10" value="{$editCategory.info}"/></td>
                    		</tr>
                    	<tr>
                    		<td>创建时间</td><td>{$editCategory.createtime}</td>
                    	</tr>
                    <tr>
                    		<td>保存</td><td><input type="image" src="{$projectUrl}/images/save.jpg" class="button"/></td>
                    	</tr>
                    </table>
                </form>
                </div>
      </div>
      <!-- 编辑分类结束 -->

      <!-- 编辑分类的设备 -->
      {if $editCategory.id neq ''}
      <div class="clr" id="editCategoryDeviceDiv" >
      	{if $addCategoryDeviceNotice neq ''}
      	<p style="color:red"><Strong>{$addCategoryDeviceNotice}</Strong></p>
      	{/if}
      	<p><img src="{$projectUrl}/images/img_1.jpg" width="30px" height="30px"><span style="font-color:#C60; font-size:16px;">分类中的设备({$categoryDevices|@count})</span></p>
                <div id = "modify_category" style="font-size:14px;">
                <form action="category.php?id={$editCategory.id}&pageIndex={$pageIndex}#saveremovecategorydevicediv" method="post">
                <input type="hidden" name="action" id="action" value="addCategoryDevice"/>
                <input type="hidden" name="categoryid" id="categoryid" value="{$editCategory.id}"/>
                    <table bgcolor="#FFFFFF" width="100%" style="font-size:14px;">
                    	<tr>
                    		<td>分类名:{$editCategory.name}</td>
                    		<td>设备:
                    			<select id="deviceid" name="deviceid">

	                        <option value="-1"></option>
	                        {foreach from=$devices item=device name=deviceslist}
	                        <option value="{$device.id}">{$device.name}</option>
	                        {/foreach}
	                        </select>
                    		</td>
                    		<td>条形码:<input type="text" id="barcode" name="barcode" size="10" value=""/>
                    		</td>
                    		<td><input type="image" src="{$projectUrl}/images/add1.jpg" class="button"/>
                    			</td>
                    	</tr>
                    </table>
                </form>
                </div>
      </div>
      {/if}
      <!-- 编辑分类结束 -->
      {if $editCategory.id neq ''}
      <div class="clr" id="saveremovecategorydevicediv">
      	<table width="100%" bgcolor="#FFFFFF" style="font-size:14px;">
                    <tr valign="top"  style="background-color:#C60">
                    		<td>创建时间</td>
                        <td>课程名字</td>
                        <td>删除</td>
                    </tr>
                    {foreach from=$categoryDevices item=categoryDevice name=categoryDeviceslist}
                    <tr valign="top"  onmouseout="this.style.backgroundColor=''"onmouseover="this.style.backgroundColor='#AAAAAA'">
                    		<form action="category.php?id={$editCategory.id}&pageIndex={$pageIndex}#saveremovecategorycoursediv" method="post">
                    			<input type="hidden" name="deviceId" value="{$categoryDevice.did}" />
                    			<input type="hidden" name="categoryId" value="{$categoryDevice.cid}" />
                    			<input type="hidden" name="action", value="removecategorydevice" />
                        <td>{$categoryDevice.createtime}</td>
                        <td>{$categoryDevice.deviceName}</td>
                        <td><a href="category.php?action=removecategorydevice&id={$editCategory.id}&deviceid={$categoryDevice.did}&pageIndex={$pageIndex}#saveremovecategorydevicediv"><span style="color:#red">删除</span></a></td>
                    	</form>
                    </tr>
                    {/foreach}
                    </table>
      </div>
      {/if}

    </div>

    <!-- 展示用户的课程列表 -->
    <div class="clr">

    </div>
  </div>
  <div class="footer">
    {include file=include/footer.html}
  </div>
</div>
<div align=center></div></body>
</html>
